<?xml version="1.0"?> 
<xsl:stylesheet 
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  version="1.0"> 
  <xsl:output method="html"/> 
 
  <xsl:template match="/r/comment"> 
	
	<table width="400px">
		<input type="hidden" name="id" id="id" value="{@id}" />
	    <tr>
	        <td>body:</td>
	        <td>
	        	<textarea id="body" name="body" col="60" row="5">.<xsl:value-of select="@body" /></textarea>
	        </td>
	    </tr>
	    <tr>
	        <td>annotatedElement:</td>
	        <td>
	        	<a href="javascript:insertAnnotatedElement('{@id}')">Insert annotatedElement</a><br /><br />
	        	<div id="divAnnotatedElement">
	        		<xsl:for-each select="./annotatedelement">
	        			<xsl:variable name="idAnnotatedElement" select="concat(@name, position())" /> 
	        			<div id="annotatedElement{$idAnnotatedElement}">
		        			<input type="hidden" name="annotatedElement" id="$idAnnotatedElement" value="{@id}" />
		        			<xsl:value-of select="@name" /> - <a href="javascript:deleteAnnotatedElement('annotatedElement{$idAnnotatedElement}')">Delete</a><br />
		        		</div>
	        		</xsl:for-each>
	        	</div>
			</td>
	    </tr>
		<tr>
	        <td>tag</td>
	        <td>
	        	<xsl:for-each select="./tag">
	        		<p><xsl:value-of select="@name" />: <xsl:value-of select="@value" /></p>
    			</xsl:for-each>
			</td>
	    </tr>	    
		<tr>
	        <td>ownedComment:</td>
	        <td>
	        	<xsl:for-each select="./ownedComment">
	        		<xsl:value-of select="@id" />:
	        		<p><xsl:value-of select="@body" /></p>
    			</xsl:for-each>
			</td>
	    </tr>	    
	    <tr>
	        <td colspan="2" align="center"><button onclick="javascript:saveComment('{@id}')">Save</button></td>
	    </tr>
	</table>
	<script type="text/javascript">
		qtAnnotatedElement = parseInt('{count(./annotatedelement)}')
	</script>
	</xsl:template>  
</xsl:stylesheet> 
